\(\int \frac {(a+b \arctan (c x)) (d+e \log (f+g x^2))}{x^3} \, dx\) [1301]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [F]
   Fricas [F]
   Sympy [F(-1)]
   Maxima [F]
   Giac [F(-1)]
   Mupad [F(-1)]

Optimal result

Integrand size = 24, antiderivative size = 528 \[ \int \frac {(a+b \arctan (c x)) \left (d+e \log \left (f+g x^2\right )\right )}{x^3} \, dx=\frac {b c e \sqrt {g} \arctan \left (\frac {\sqrt {g} x}{\sqrt {f}}\right )}{\sqrt {f}}+\frac {a e g \log (x)}{f}-\frac {b e \left (c^2 f-g\right ) \arctan (c x) \log \left (\frac {2}{1-i c x}\right )}{f}+\frac {b e \left (c^2 f-g\right ) \arctan (c x) \log \left (\frac {2 c \left (\sqrt {-f}-\sqrt {g} x\right )}{\left (c \sqrt {-f}-i \sqrt {g}\right ) (1-i c x)}\right )}{2 f}+\frac {b e \left (c^2 f-g\right ) \arctan (c x) \log \left (\frac {2 c \left (\sqrt {-f}+\sqrt {g} x\right )}{\left (c \sqrt {-f}+i \sqrt {g}\right ) (1-i c x)}\right )}{2 f}-\frac {a e g \log \left (f+g x^2\right )}{2 f}-\frac {b c \left (d+e \log \left (f+g x^2\right )\right )}{2 x}-\frac {1}{2} b c^2 \arctan (c x) \left (d+e \log \left (f+g x^2\right )\right )-\frac {(a+b \arctan (c x)) \left (d+e \log \left (f+g x^2\right )\right )}{2 x^2}+\frac {i b e g \operatorname {PolyLog}(2,-i c x)}{2 f}-\frac {i b e g \operatorname {PolyLog}(2,i c x)}{2 f}+\frac {i b e \left (c^2 f-g\right ) \operatorname {PolyLog}\left (2,1-\frac {2}{1-i c x}\right )}{2 f}-\frac {i b e \left (c^2 f-g\right ) \operatorname {PolyLog}\left (2,1-\frac {2 c \left (\sqrt {-f}-\sqrt {g} x\right )}{\left (c \sqrt {-f}-i \sqrt {g}\right ) (1-i c x)}\right )}{4 f}-\frac {i b e \left (c^2 f-g\right ) \operatorname {PolyLog}\left (2,1-\frac {2 c \left (\sqrt {-f}+\sqrt {g} x\right )}{\left (c \sqrt {-f}+i \sqrt {g}\right ) (1-i c x)}\right )}{4 f} \]

[Out]

a*e*g*ln(x)/f-b*e*(c^2*f-g)*arctan(c*x)*ln(2/(1-I*c*x))/f-1/2*a*e*g*ln(g*x^2+f)/f-1/2*b*c*(d+e*ln(g*x^2+f))/x-
1/2*b*c^2*arctan(c*x)*(d+e*ln(g*x^2+f))-1/2*(a+b*arctan(c*x))*(d+e*ln(g*x^2+f))/x^2+1/2*b*e*(c^2*f-g)*arctan(c
*x)*ln(2*c*((-f)^(1/2)-x*g^(1/2))/(1-I*c*x)/(c*(-f)^(1/2)-I*g^(1/2)))/f+1/2*b*e*(c^2*f-g)*arctan(c*x)*ln(2*c*(
(-f)^(1/2)+x*g^(1/2))/(1-I*c*x)/(c*(-f)^(1/2)+I*g^(1/2)))/f+1/2*I*b*e*g*polylog(2,-I*c*x)/f-1/2*I*b*e*g*polylo
g(2,I*c*x)/f+1/2*I*b*e*(c^2*f-g)*polylog(2,1-2/(1-I*c*x))/f-1/4*I*b*e*(c^2*f-g)*polylog(2,1-2*c*((-f)^(1/2)-x*
g^(1/2))/(1-I*c*x)/(c*(-f)^(1/2)-I*g^(1/2)))/f-1/4*I*b*e*(c^2*f-g)*polylog(2,1-2*c*((-f)^(1/2)+x*g^(1/2))/(1-I
*c*x)/(c*(-f)^(1/2)+I*g^(1/2)))/f+b*c*e*arctan(x*g^(1/2)/f^(1/2))*g^(1/2)/f^(1/2)

Rubi [A] (verified)

Time = 0.52 (sec) , antiderivative size = 528, normalized size of antiderivative = 1.00, number of steps used = 22, number of rules used = 18, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.750, Rules used = {4946, 331, 209, 5141, 815, 649, 211, 266, 457, 78, 6857, 4940, 2438, 5048, 4966, 2449, 2352, 2497} \[ \int \frac {(a+b \arctan (c x)) \left (d+e \log \left (f+g x^2\right )\right )}{x^3} \, dx=-\frac {(a+b \arctan (c x)) \left (d+e \log \left (f+g x^2\right )\right )}{2 x^2}-\frac {a e g \log \left (f+g x^2\right )}{2 f}+\frac {a e g \log (x)}{f}-\frac {1}{2} b c^2 \arctan (c x) \left (d+e \log \left (f+g x^2\right )\right )-\frac {b e \arctan (c x) \left (c^2 f-g\right ) \log \left (\frac {2}{1-i c x}\right )}{f}+\frac {b e \arctan (c x) \left (c^2 f-g\right ) \log \left (\frac {2 c \left (\sqrt {-f}-\sqrt {g} x\right )}{(1-i c x) \left (c \sqrt {-f}-i \sqrt {g}\right )}\right )}{2 f}+\frac {b e \arctan (c x) \left (c^2 f-g\right ) \log \left (\frac {2 c \left (\sqrt {-f}+\sqrt {g} x\right )}{(1-i c x) \left (c \sqrt {-f}+i \sqrt {g}\right )}\right )}{2 f}+\frac {b c e \sqrt {g} \arctan \left (\frac {\sqrt {g} x}{\sqrt {f}}\right )}{\sqrt {f}}+\frac {i b e \left (c^2 f-g\right ) \operatorname {PolyLog}\left (2,1-\frac {2}{1-i c x}\right )}{2 f}-\frac {i b e \left (c^2 f-g\right ) \operatorname {PolyLog}\left (2,1-\frac {2 c \left (\sqrt {-f}-\sqrt {g} x\right )}{\left (c \sqrt {-f}-i \sqrt {g}\right ) (1-i c x)}\right )}{4 f}-\frac {i b e \left (c^2 f-g\right ) \operatorname {PolyLog}\left (2,1-\frac {2 c \left (\sqrt {g} x+\sqrt {-f}\right )}{\left (\sqrt {-f} c+i \sqrt {g}\right ) (1-i c x)}\right )}{4 f}-\frac {b c \left (d+e \log \left (f+g x^2\right )\right )}{2 x}+\frac {i b e g \operatorname {PolyLog}(2,-i c x)}{2 f}-\frac {i b e g \operatorname {PolyLog}(2,i c x)}{2 f} \]

[In]

Int[((a + b*ArcTan[c*x])*(d + e*Log[f + g*x^2]))/x^3,x]

[Out]

(b*c*e*Sqrt[g]*ArcTan[(Sqrt[g]*x)/Sqrt[f]])/Sqrt[f] + (a*e*g*Log[x])/f - (b*e*(c^2*f - g)*ArcTan[c*x]*Log[2/(1
 - I*c*x)])/f + (b*e*(c^2*f - g)*ArcTan[c*x]*Log[(2*c*(Sqrt[-f] - Sqrt[g]*x))/((c*Sqrt[-f] - I*Sqrt[g])*(1 - I
*c*x))])/(2*f) + (b*e*(c^2*f - g)*ArcTan[c*x]*Log[(2*c*(Sqrt[-f] + Sqrt[g]*x))/((c*Sqrt[-f] + I*Sqrt[g])*(1 -
I*c*x))])/(2*f) - (a*e*g*Log[f + g*x^2])/(2*f) - (b*c*(d + e*Log[f + g*x^2]))/(2*x) - (b*c^2*ArcTan[c*x]*(d +
e*Log[f + g*x^2]))/2 - ((a + b*ArcTan[c*x])*(d + e*Log[f + g*x^2]))/(2*x^2) + ((I/2)*b*e*g*PolyLog[2, (-I)*c*x
])/f - ((I/2)*b*e*g*PolyLog[2, I*c*x])/f + ((I/2)*b*e*(c^2*f - g)*PolyLog[2, 1 - 2/(1 - I*c*x)])/f - ((I/4)*b*
e*(c^2*f - g)*PolyLog[2, 1 - (2*c*(Sqrt[-f] - Sqrt[g]*x))/((c*Sqrt[-f] - I*Sqrt[g])*(1 - I*c*x))])/f - ((I/4)*
b*e*(c^2*f - g)*PolyLog[2, 1 - (2*c*(Sqrt[-f] + Sqrt[g]*x))/((c*Sqrt[-f] + I*Sqrt[g])*(1 - I*c*x))])/f

Rule 78

Int[((a_.) + (b_.)*(x_))*((c_) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> Int[ExpandIntegran
d[(a + b*x)*(c + d*x)^n*(e + f*x)^p, x], x] /; FreeQ[{a, b, c, d, e, f, n}, x] && NeQ[b*c - a*d, 0] && ((ILtQ[
n, 0] && ILtQ[p, 0]) || EqQ[p, 1] || (IGtQ[p, 0] && ( !IntegerQ[n] || LeQ[9*p + 5*(n + 2), 0] || GeQ[n + p + 1
, 0] || (GeQ[n + p + 2, 0] && RationalQ[a, b, c, d, e, f]))))

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 211

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]/a)*ArcTan[x/Rt[a/b, 2]], x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rule 266

Int[(x_)^(m_.)/((a_) + (b_.)*(x_)^(n_)), x_Symbol] :> Simp[Log[RemoveContent[a + b*x^n, x]]/(b*n), x] /; FreeQ
[{a, b, m, n}, x] && EqQ[m, n - 1]

Rule 331

Int[((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[(c*x)^(m + 1)*((a + b*x^n)^(p + 1)/(a*c
*(m + 1))), x] - Dist[b*((m + n*(p + 1) + 1)/(a*c^n*(m + 1))), Int[(c*x)^(m + n)*(a + b*x^n)^p, x], x] /; Free
Q[{a, b, c, p}, x] && IGtQ[n, 0] && LtQ[m, -1] && IntBinomialQ[a, b, c, n, m, p, x]

Rule 457

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.), x_Symbol] :> Dist[1/n, Subst[Int
[x^(Simplify[(m + 1)/n] - 1)*(a + b*x)^p*(c + d*x)^q, x], x, x^n], x] /; FreeQ[{a, b, c, d, m, n, p, q}, x] &&
 NeQ[b*c - a*d, 0] && IntegerQ[Simplify[(m + 1)/n]]

Rule 649

Int[((d_) + (e_.)*(x_))/((a_) + (c_.)*(x_)^2), x_Symbol] :> Dist[d, Int[1/(a + c*x^2), x], x] + Dist[e, Int[x/
(a + c*x^2), x], x] /; FreeQ[{a, c, d, e}, x] &&  !NiceSqrtQ[(-a)*c]

Rule 815

Int[(((d_.) + (e_.)*(x_))^(m_)*((f_.) + (g_.)*(x_)))/((a_) + (c_.)*(x_)^2), x_Symbol] :> Int[ExpandIntegrand[(
d + e*x)^m*((f + g*x)/(a + c*x^2)), x], x] /; FreeQ[{a, c, d, e, f, g}, x] && NeQ[c*d^2 + a*e^2, 0] && Integer
Q[m]

Rule 2352

Int[Log[(c_.)*(x_)]/((d_) + (e_.)*(x_)), x_Symbol] :> Simp[(-e^(-1))*PolyLog[2, 1 - c*x], x] /; FreeQ[{c, d, e
}, x] && EqQ[e + c*d, 0]

Rule 2438

Int[Log[(c_.)*((d_) + (e_.)*(x_)^(n_.))]/(x_), x_Symbol] :> Simp[-PolyLog[2, (-c)*e*x^n]/n, x] /; FreeQ[{c, d,
 e, n}, x] && EqQ[c*d, 1]

Rule 2449

Int[Log[(c_.)/((d_) + (e_.)*(x_))]/((f_) + (g_.)*(x_)^2), x_Symbol] :> Dist[-e/g, Subst[Int[Log[2*d*x]/(1 - 2*
d*x), x], x, 1/(d + e*x)], x] /; FreeQ[{c, d, e, f, g}, x] && EqQ[c, 2*d] && EqQ[e^2*f + d^2*g, 0]

Rule 2497

Int[Log[u_]*(Pq_)^(m_.), x_Symbol] :> With[{C = FullSimplify[Pq^m*((1 - u)/D[u, x])]}, Simp[C*PolyLog[2, 1 - u
], x] /; FreeQ[C, x]] /; IntegerQ[m] && PolyQ[Pq, x] && RationalFunctionQ[u, x] && LeQ[RationalFunctionExponen
ts[u, x][[2]], Expon[Pq, x]]

Rule 4940

Int[((a_.) + ArcTan[(c_.)*(x_)]*(b_.))/(x_), x_Symbol] :> Simp[a*Log[x], x] + (Dist[I*(b/2), Int[Log[1 - I*c*x
]/x, x], x] - Dist[I*(b/2), Int[Log[1 + I*c*x]/x, x], x]) /; FreeQ[{a, b, c}, x]

Rule 4946

Int[((a_.) + ArcTan[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)*(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)*((a + b*ArcTan[c*x^
n])^p/(m + 1)), x] - Dist[b*c*n*(p/(m + 1)), Int[x^(m + n)*((a + b*ArcTan[c*x^n])^(p - 1)/(1 + c^2*x^(2*n))),
x], x] /; FreeQ[{a, b, c, m, n}, x] && IGtQ[p, 0] && (EqQ[p, 1] || (EqQ[n, 1] && IntegerQ[m])) && NeQ[m, -1]

Rule 4966

Int[((a_.) + ArcTan[(c_.)*(x_)]*(b_.))/((d_) + (e_.)*(x_)), x_Symbol] :> Simp[(-(a + b*ArcTan[c*x]))*(Log[2/(1
 - I*c*x)]/e), x] + (Dist[b*(c/e), Int[Log[2/(1 - I*c*x)]/(1 + c^2*x^2), x], x] - Dist[b*(c/e), Int[Log[2*c*((
d + e*x)/((c*d + I*e)*(1 - I*c*x)))]/(1 + c^2*x^2), x], x] + Simp[(a + b*ArcTan[c*x])*(Log[2*c*((d + e*x)/((c*
d + I*e)*(1 - I*c*x)))]/e), x]) /; FreeQ[{a, b, c, d, e}, x] && NeQ[c^2*d^2 + e^2, 0]

Rule 5048

Int[(((a_.) + ArcTan[(c_.)*(x_)]*(b_.))*(x_)^(m_.))/((d_) + (e_.)*(x_)^2), x_Symbol] :> Int[ExpandIntegrand[a
+ b*ArcTan[c*x], x^m/(d + e*x^2), x], x] /; FreeQ[{a, b, c, d, e}, x] && IntegerQ[m] &&  !(EqQ[m, 1] && NeQ[a,
 0])

Rule 5141

Int[((a_.) + ArcTan[(c_.)*(x_)]*(b_.))*((d_.) + Log[(f_.) + (g_.)*(x_)^2]*(e_.))*(x_)^(m_.), x_Symbol] :> With
[{u = IntHide[x^m*(a + b*ArcTan[c*x]), x]}, Dist[d + e*Log[f + g*x^2], u, x] - Dist[2*e*g, Int[ExpandIntegrand
[x*(u/(f + g*x^2)), x], x], x]] /; FreeQ[{a, b, c, d, e, f, g}, x] && IntegerQ[m] && NeQ[m, -1]

Rule 6857

Int[(u_)/((a_) + (b_.)*(x_)^(n_)), x_Symbol] :> With[{v = RationalFunctionExpand[u/(a + b*x^n), x]}, Int[v, x]
 /; SumQ[v]] /; FreeQ[{a, b}, x] && IGtQ[n, 0]

Rubi steps \begin{align*} \text {integral}& = -\frac {b c \left (d+e \log \left (f+g x^2\right )\right )}{2 x}-\frac {1}{2} b c^2 \arctan (c x) \left (d+e \log \left (f+g x^2\right )\right )-\frac {(a+b \arctan (c x)) \left (d+e \log \left (f+g x^2\right )\right )}{2 x^2}-(2 e g) \int \left (\frac {-a-b c x}{2 x \left (f+g x^2\right )}-\frac {b \left (1+c^2 x^2\right ) \arctan (c x)}{2 x \left (f+g x^2\right )}\right ) \, dx \\ & = -\frac {b c \left (d+e \log \left (f+g x^2\right )\right )}{2 x}-\frac {1}{2} b c^2 \arctan (c x) \left (d+e \log \left (f+g x^2\right )\right )-\frac {(a+b \arctan (c x)) \left (d+e \log \left (f+g x^2\right )\right )}{2 x^2}-(e g) \int \frac {-a-b c x}{x \left (f+g x^2\right )} \, dx+(b e g) \int \frac {\left (1+c^2 x^2\right ) \arctan (c x)}{x \left (f+g x^2\right )} \, dx \\ & = -\frac {b c \left (d+e \log \left (f+g x^2\right )\right )}{2 x}-\frac {1}{2} b c^2 \arctan (c x) \left (d+e \log \left (f+g x^2\right )\right )-\frac {(a+b \arctan (c x)) \left (d+e \log \left (f+g x^2\right )\right )}{2 x^2}-(e g) \int \left (-\frac {a}{f x}+\frac {-b c f+a g x}{f \left (f+g x^2\right )}\right ) \, dx+(b e g) \int \left (\frac {\arctan (c x)}{f x}+\frac {\left (c^2 f-g\right ) x \arctan (c x)}{f \left (f+g x^2\right )}\right ) \, dx \\ & = \frac {a e g \log (x)}{f}-\frac {b c \left (d+e \log \left (f+g x^2\right )\right )}{2 x}-\frac {1}{2} b c^2 \arctan (c x) \left (d+e \log \left (f+g x^2\right )\right )-\frac {(a+b \arctan (c x)) \left (d+e \log \left (f+g x^2\right )\right )}{2 x^2}-\frac {(e g) \int \frac {-b c f+a g x}{f+g x^2} \, dx}{f}+\frac {(b e g) \int \frac {\arctan (c x)}{x} \, dx}{f}+\frac {\left (b e \left (c^2 f-g\right ) g\right ) \int \frac {x \arctan (c x)}{f+g x^2} \, dx}{f} \\ & = \frac {a e g \log (x)}{f}-\frac {b c \left (d+e \log \left (f+g x^2\right )\right )}{2 x}-\frac {1}{2} b c^2 \arctan (c x) \left (d+e \log \left (f+g x^2\right )\right )-\frac {(a+b \arctan (c x)) \left (d+e \log \left (f+g x^2\right )\right )}{2 x^2}+(b c e g) \int \frac {1}{f+g x^2} \, dx+\frac {(i b e g) \int \frac {\log (1-i c x)}{x} \, dx}{2 f}-\frac {(i b e g) \int \frac {\log (1+i c x)}{x} \, dx}{2 f}+\frac {\left (b e \left (c^2 f-g\right ) g\right ) \int \left (-\frac {\arctan (c x)}{2 \sqrt {g} \left (\sqrt {-f}-\sqrt {g} x\right )}+\frac {\arctan (c x)}{2 \sqrt {g} \left (\sqrt {-f}+\sqrt {g} x\right )}\right ) \, dx}{f}-\frac {\left (a e g^2\right ) \int \frac {x}{f+g x^2} \, dx}{f} \\ & = \frac {b c e \sqrt {g} \arctan \left (\frac {\sqrt {g} x}{\sqrt {f}}\right )}{\sqrt {f}}+\frac {a e g \log (x)}{f}-\frac {a e g \log \left (f+g x^2\right )}{2 f}-\frac {b c \left (d+e \log \left (f+g x^2\right )\right )}{2 x}-\frac {1}{2} b c^2 \arctan (c x) \left (d+e \log \left (f+g x^2\right )\right )-\frac {(a+b \arctan (c x)) \left (d+e \log \left (f+g x^2\right )\right )}{2 x^2}+\frac {i b e g \operatorname {PolyLog}(2,-i c x)}{2 f}-\frac {i b e g \operatorname {PolyLog}(2,i c x)}{2 f}-\frac {\left (b e \left (c^2 f-g\right ) \sqrt {g}\right ) \int \frac {\arctan (c x)}{\sqrt {-f}-\sqrt {g} x} \, dx}{2 f}+\frac {\left (b e \left (c^2 f-g\right ) \sqrt {g}\right ) \int \frac {\arctan (c x)}{\sqrt {-f}+\sqrt {g} x} \, dx}{2 f} \\ & = \frac {b c e \sqrt {g} \arctan \left (\frac {\sqrt {g} x}{\sqrt {f}}\right )}{\sqrt {f}}+\frac {a e g \log (x)}{f}-\frac {b e \left (c^2 f-g\right ) \arctan (c x) \log \left (\frac {2}{1-i c x}\right )}{f}+\frac {b e \left (c^2 f-g\right ) \arctan (c x) \log \left (\frac {2 c \left (\sqrt {-f}-\sqrt {g} x\right )}{\left (c \sqrt {-f}-i \sqrt {g}\right ) (1-i c x)}\right )}{2 f}+\frac {b e \left (c^2 f-g\right ) \arctan (c x) \log \left (\frac {2 c \left (\sqrt {-f}+\sqrt {g} x\right )}{\left (c \sqrt {-f}+i \sqrt {g}\right ) (1-i c x)}\right )}{2 f}-\frac {a e g \log \left (f+g x^2\right )}{2 f}-\frac {b c \left (d+e \log \left (f+g x^2\right )\right )}{2 x}-\frac {1}{2} b c^2 \arctan (c x) \left (d+e \log \left (f+g x^2\right )\right )-\frac {(a+b \arctan (c x)) \left (d+e \log \left (f+g x^2\right )\right )}{2 x^2}+\frac {i b e g \operatorname {PolyLog}(2,-i c x)}{2 f}-\frac {i b e g \operatorname {PolyLog}(2,i c x)}{2 f}+2 \frac {\left (b c e \left (c^2 f-g\right )\right ) \int \frac {\log \left (\frac {2}{1-i c x}\right )}{1+c^2 x^2} \, dx}{2 f}-\frac {\left (b c e \left (c^2 f-g\right )\right ) \int \frac {\log \left (\frac {2 c \left (\sqrt {-f}-\sqrt {g} x\right )}{\left (c \sqrt {-f}-i \sqrt {g}\right ) (1-i c x)}\right )}{1+c^2 x^2} \, dx}{2 f}-\frac {\left (b c e \left (c^2 f-g\right )\right ) \int \frac {\log \left (\frac {2 c \left (\sqrt {-f}+\sqrt {g} x\right )}{\left (c \sqrt {-f}+i \sqrt {g}\right ) (1-i c x)}\right )}{1+c^2 x^2} \, dx}{2 f} \\ & = \frac {b c e \sqrt {g} \arctan \left (\frac {\sqrt {g} x}{\sqrt {f}}\right )}{\sqrt {f}}+\frac {a e g \log (x)}{f}-\frac {b e \left (c^2 f-g\right ) \arctan (c x) \log \left (\frac {2}{1-i c x}\right )}{f}+\frac {b e \left (c^2 f-g\right ) \arctan (c x) \log \left (\frac {2 c \left (\sqrt {-f}-\sqrt {g} x\right )}{\left (c \sqrt {-f}-i \sqrt {g}\right ) (1-i c x)}\right )}{2 f}+\frac {b e \left (c^2 f-g\right ) \arctan (c x) \log \left (\frac {2 c \left (\sqrt {-f}+\sqrt {g} x\right )}{\left (c \sqrt {-f}+i \sqrt {g}\right ) (1-i c x)}\right )}{2 f}-\frac {a e g \log \left (f+g x^2\right )}{2 f}-\frac {b c \left (d+e \log \left (f+g x^2\right )\right )}{2 x}-\frac {1}{2} b c^2 \arctan (c x) \left (d+e \log \left (f+g x^2\right )\right )-\frac {(a+b \arctan (c x)) \left (d+e \log \left (f+g x^2\right )\right )}{2 x^2}+\frac {i b e g \operatorname {PolyLog}(2,-i c x)}{2 f}-\frac {i b e g \operatorname {PolyLog}(2,i c x)}{2 f}-\frac {i b e \left (c^2 f-g\right ) \operatorname {PolyLog}\left (2,1-\frac {2 c \left (\sqrt {-f}-\sqrt {g} x\right )}{\left (c \sqrt {-f}-i \sqrt {g}\right ) (1-i c x)}\right )}{4 f}-\frac {i b e \left (c^2 f-g\right ) \operatorname {PolyLog}\left (2,1-\frac {2 c \left (\sqrt {-f}+\sqrt {g} x\right )}{\left (c \sqrt {-f}+i \sqrt {g}\right ) (1-i c x)}\right )}{4 f}+2 \frac {\left (i b e \left (c^2 f-g\right )\right ) \text {Subst}\left (\int \frac {\log (2 x)}{1-2 x} \, dx,x,\frac {1}{1-i c x}\right )}{2 f} \\ & = \frac {b c e \sqrt {g} \arctan \left (\frac {\sqrt {g} x}{\sqrt {f}}\right )}{\sqrt {f}}+\frac {a e g \log (x)}{f}-\frac {b e \left (c^2 f-g\right ) \arctan (c x) \log \left (\frac {2}{1-i c x}\right )}{f}+\frac {b e \left (c^2 f-g\right ) \arctan (c x) \log \left (\frac {2 c \left (\sqrt {-f}-\sqrt {g} x\right )}{\left (c \sqrt {-f}-i \sqrt {g}\right ) (1-i c x)}\right )}{2 f}+\frac {b e \left (c^2 f-g\right ) \arctan (c x) \log \left (\frac {2 c \left (\sqrt {-f}+\sqrt {g} x\right )}{\left (c \sqrt {-f}+i \sqrt {g}\right ) (1-i c x)}\right )}{2 f}-\frac {a e g \log \left (f+g x^2\right )}{2 f}-\frac {b c \left (d+e \log \left (f+g x^2\right )\right )}{2 x}-\frac {1}{2} b c^2 \arctan (c x) \left (d+e \log \left (f+g x^2\right )\right )-\frac {(a+b \arctan (c x)) \left (d+e \log \left (f+g x^2\right )\right )}{2 x^2}+\frac {i b e g \operatorname {PolyLog}(2,-i c x)}{2 f}-\frac {i b e g \operatorname {PolyLog}(2,i c x)}{2 f}+\frac {i b e \left (c^2 f-g\right ) \operatorname {PolyLog}\left (2,1-\frac {2}{1-i c x}\right )}{2 f}-\frac {i b e \left (c^2 f-g\right ) \operatorname {PolyLog}\left (2,1-\frac {2 c \left (\sqrt {-f}-\sqrt {g} x\right )}{\left (c \sqrt {-f}-i \sqrt {g}\right ) (1-i c x)}\right )}{4 f}-\frac {i b e \left (c^2 f-g\right ) \operatorname {PolyLog}\left (2,1-\frac {2 c \left (\sqrt {-f}+\sqrt {g} x\right )}{\left (c \sqrt {-f}+i \sqrt {g}\right ) (1-i c x)}\right )}{4 f} \\ \end{align*}

Mathematica [B] (verified)

Both result and optimal contain complex but leaf count is larger than twice the leaf count of optimal. \(1217\) vs. \(2(528)=1056\).

Time = 5.20 (sec) , antiderivative size = 1217, normalized size of antiderivative = 2.30 \[ \int \frac {(a+b \arctan (c x)) \left (d+e \log \left (f+g x^2\right )\right )}{x^3} \, dx=-\frac {2 a d f+2 b c d f x+2 b d f \arctan (c x)+2 b c^2 d f x^2 \arctan (c x)-4 b c e \sqrt {f} \sqrt {g} x^2 \arctan \left (\frac {\sqrt {g} x}{\sqrt {f}}\right )-4 i b c^2 e f x^2 \arcsin \left (\sqrt {\frac {c^2 f}{c^2 f-g}}\right ) \arctan \left (\frac {c g x}{\sqrt {c^2 f g}}\right )+4 i b e g x^2 \arcsin \left (\sqrt {\frac {c^2 f}{c^2 f-g}}\right ) \arctan \left (\frac {c g x}{\sqrt {c^2 f g}}\right )-4 b e g x^2 \arctan (c x) \log \left (1-e^{2 i \arctan (c x)}\right )+4 b c^2 e f x^2 \arctan (c x) \log \left (1+e^{2 i \arctan (c x)}\right )-2 b c^2 e f x^2 \arcsin \left (\sqrt {\frac {c^2 f}{c^2 f-g}}\right ) \log \left (\frac {c^2 \left (1+e^{2 i \arctan (c x)}\right ) f+\left (-1+e^{2 i \arctan (c x)}\right ) g-2 e^{2 i \arctan (c x)} \sqrt {c^2 f g}}{c^2 f-g}\right )+2 b e g x^2 \arcsin \left (\sqrt {\frac {c^2 f}{c^2 f-g}}\right ) \log \left (\frac {c^2 \left (1+e^{2 i \arctan (c x)}\right ) f+\left (-1+e^{2 i \arctan (c x)}\right ) g-2 e^{2 i \arctan (c x)} \sqrt {c^2 f g}}{c^2 f-g}\right )-2 b c^2 e f x^2 \arctan (c x) \log \left (\frac {c^2 \left (1+e^{2 i \arctan (c x)}\right ) f+\left (-1+e^{2 i \arctan (c x)}\right ) g-2 e^{2 i \arctan (c x)} \sqrt {c^2 f g}}{c^2 f-g}\right )+2 b e g x^2 \arctan (c x) \log \left (\frac {c^2 \left (1+e^{2 i \arctan (c x)}\right ) f+\left (-1+e^{2 i \arctan (c x)}\right ) g-2 e^{2 i \arctan (c x)} \sqrt {c^2 f g}}{c^2 f-g}\right )+2 b c^2 e f x^2 \arcsin \left (\sqrt {\frac {c^2 f}{c^2 f-g}}\right ) \log \left (1+\frac {e^{2 i \arctan (c x)} \left (c^2 f+g+2 \sqrt {c^2 f g}\right )}{c^2 f-g}\right )-2 b e g x^2 \arcsin \left (\sqrt {\frac {c^2 f}{c^2 f-g}}\right ) \log \left (1+\frac {e^{2 i \arctan (c x)} \left (c^2 f+g+2 \sqrt {c^2 f g}\right )}{c^2 f-g}\right )-2 b c^2 e f x^2 \arctan (c x) \log \left (1+\frac {e^{2 i \arctan (c x)} \left (c^2 f+g+2 \sqrt {c^2 f g}\right )}{c^2 f-g}\right )+2 b e g x^2 \arctan (c x) \log \left (1+\frac {e^{2 i \arctan (c x)} \left (c^2 f+g+2 \sqrt {c^2 f g}\right )}{c^2 f-g}\right )-4 a e g x^2 \log (x)+2 a e f \log \left (f+g x^2\right )+2 b c e f x \log \left (f+g x^2\right )+2 a e g x^2 \log \left (f+g x^2\right )+2 b e f \arctan (c x) \log \left (f+g x^2\right )+2 b c^2 e f x^2 \arctan (c x) \log \left (f+g x^2\right )-2 i b c^2 e f x^2 \operatorname {PolyLog}\left (2,-e^{2 i \arctan (c x)}\right )+2 i b e g x^2 \operatorname {PolyLog}\left (2,e^{2 i \arctan (c x)}\right )+i b c^2 e f x^2 \operatorname {PolyLog}\left (2,\frac {e^{2 i \arctan (c x)} \left (-c^2 f-g+2 \sqrt {c^2 f g}\right )}{c^2 f-g}\right )-i b e g x^2 \operatorname {PolyLog}\left (2,\frac {e^{2 i \arctan (c x)} \left (-c^2 f-g+2 \sqrt {c^2 f g}\right )}{c^2 f-g}\right )+i b c^2 e f x^2 \operatorname {PolyLog}\left (2,-\frac {e^{2 i \arctan (c x)} \left (c^2 f+g+2 \sqrt {c^2 f g}\right )}{c^2 f-g}\right )-i b e g x^2 \operatorname {PolyLog}\left (2,-\frac {e^{2 i \arctan (c x)} \left (c^2 f+g+2 \sqrt {c^2 f g}\right )}{c^2 f-g}\right )}{4 f x^2} \]

[In]

Integrate[((a + b*ArcTan[c*x])*(d + e*Log[f + g*x^2]))/x^3,x]

[Out]

-1/4*(2*a*d*f + 2*b*c*d*f*x + 2*b*d*f*ArcTan[c*x] + 2*b*c^2*d*f*x^2*ArcTan[c*x] - 4*b*c*e*Sqrt[f]*Sqrt[g]*x^2*
ArcTan[(Sqrt[g]*x)/Sqrt[f]] - (4*I)*b*c^2*e*f*x^2*ArcSin[Sqrt[(c^2*f)/(c^2*f - g)]]*ArcTan[(c*g*x)/Sqrt[c^2*f*
g]] + (4*I)*b*e*g*x^2*ArcSin[Sqrt[(c^2*f)/(c^2*f - g)]]*ArcTan[(c*g*x)/Sqrt[c^2*f*g]] - 4*b*e*g*x^2*ArcTan[c*x
]*Log[1 - E^((2*I)*ArcTan[c*x])] + 4*b*c^2*e*f*x^2*ArcTan[c*x]*Log[1 + E^((2*I)*ArcTan[c*x])] - 2*b*c^2*e*f*x^
2*ArcSin[Sqrt[(c^2*f)/(c^2*f - g)]]*Log[(c^2*(1 + E^((2*I)*ArcTan[c*x]))*f + (-1 + E^((2*I)*ArcTan[c*x]))*g -
2*E^((2*I)*ArcTan[c*x])*Sqrt[c^2*f*g])/(c^2*f - g)] + 2*b*e*g*x^2*ArcSin[Sqrt[(c^2*f)/(c^2*f - g)]]*Log[(c^2*(
1 + E^((2*I)*ArcTan[c*x]))*f + (-1 + E^((2*I)*ArcTan[c*x]))*g - 2*E^((2*I)*ArcTan[c*x])*Sqrt[c^2*f*g])/(c^2*f
- g)] - 2*b*c^2*e*f*x^2*ArcTan[c*x]*Log[(c^2*(1 + E^((2*I)*ArcTan[c*x]))*f + (-1 + E^((2*I)*ArcTan[c*x]))*g -
2*E^((2*I)*ArcTan[c*x])*Sqrt[c^2*f*g])/(c^2*f - g)] + 2*b*e*g*x^2*ArcTan[c*x]*Log[(c^2*(1 + E^((2*I)*ArcTan[c*
x]))*f + (-1 + E^((2*I)*ArcTan[c*x]))*g - 2*E^((2*I)*ArcTan[c*x])*Sqrt[c^2*f*g])/(c^2*f - g)] + 2*b*c^2*e*f*x^
2*ArcSin[Sqrt[(c^2*f)/(c^2*f - g)]]*Log[1 + (E^((2*I)*ArcTan[c*x])*(c^2*f + g + 2*Sqrt[c^2*f*g]))/(c^2*f - g)]
 - 2*b*e*g*x^2*ArcSin[Sqrt[(c^2*f)/(c^2*f - g)]]*Log[1 + (E^((2*I)*ArcTan[c*x])*(c^2*f + g + 2*Sqrt[c^2*f*g]))
/(c^2*f - g)] - 2*b*c^2*e*f*x^2*ArcTan[c*x]*Log[1 + (E^((2*I)*ArcTan[c*x])*(c^2*f + g + 2*Sqrt[c^2*f*g]))/(c^2
*f - g)] + 2*b*e*g*x^2*ArcTan[c*x]*Log[1 + (E^((2*I)*ArcTan[c*x])*(c^2*f + g + 2*Sqrt[c^2*f*g]))/(c^2*f - g)]
- 4*a*e*g*x^2*Log[x] + 2*a*e*f*Log[f + g*x^2] + 2*b*c*e*f*x*Log[f + g*x^2] + 2*a*e*g*x^2*Log[f + g*x^2] + 2*b*
e*f*ArcTan[c*x]*Log[f + g*x^2] + 2*b*c^2*e*f*x^2*ArcTan[c*x]*Log[f + g*x^2] - (2*I)*b*c^2*e*f*x^2*PolyLog[2, -
E^((2*I)*ArcTan[c*x])] + (2*I)*b*e*g*x^2*PolyLog[2, E^((2*I)*ArcTan[c*x])] + I*b*c^2*e*f*x^2*PolyLog[2, (E^((2
*I)*ArcTan[c*x])*(-(c^2*f) - g + 2*Sqrt[c^2*f*g]))/(c^2*f - g)] - I*b*e*g*x^2*PolyLog[2, (E^((2*I)*ArcTan[c*x]
)*(-(c^2*f) - g + 2*Sqrt[c^2*f*g]))/(c^2*f - g)] + I*b*c^2*e*f*x^2*PolyLog[2, -((E^((2*I)*ArcTan[c*x])*(c^2*f
+ g + 2*Sqrt[c^2*f*g]))/(c^2*f - g))] - I*b*e*g*x^2*PolyLog[2, -((E^((2*I)*ArcTan[c*x])*(c^2*f + g + 2*Sqrt[c^
2*f*g]))/(c^2*f - g))])/(f*x^2)

Maple [F]

\[\int \frac {\left (a +b \arctan \left (c x \right )\right ) \left (d +e \ln \left (g \,x^{2}+f \right )\right )}{x^{3}}d x\]

[In]

int((a+b*arctan(c*x))*(d+e*ln(g*x^2+f))/x^3,x)

[Out]

int((a+b*arctan(c*x))*(d+e*ln(g*x^2+f))/x^3,x)

Fricas [F]

\[ \int \frac {(a+b \arctan (c x)) \left (d+e \log \left (f+g x^2\right )\right )}{x^3} \, dx=\int { \frac {{\left (b \arctan \left (c x\right ) + a\right )} {\left (e \log \left (g x^{2} + f\right ) + d\right )}}{x^{3}} \,d x } \]

[In]

integrate((a+b*arctan(c*x))*(d+e*log(g*x^2+f))/x^3,x, algorithm="fricas")

[Out]

integral((b*d*arctan(c*x) + a*d + (b*e*arctan(c*x) + a*e)*log(g*x^2 + f))/x^3, x)

Sympy [F(-1)]

Timed out. \[ \int \frac {(a+b \arctan (c x)) \left (d+e \log \left (f+g x^2\right )\right )}{x^3} \, dx=\text {Timed out} \]

[In]

integrate((a+b*atan(c*x))*(d+e*ln(g*x**2+f))/x**3,x)

[Out]

Timed out

Maxima [F]

\[ \int \frac {(a+b \arctan (c x)) \left (d+e \log \left (f+g x^2\right )\right )}{x^3} \, dx=\int { \frac {{\left (b \arctan \left (c x\right ) + a\right )} {\left (e \log \left (g x^{2} + f\right ) + d\right )}}{x^{3}} \,d x } \]

[In]

integrate((a+b*arctan(c*x))*(d+e*log(g*x^2+f))/x^3,x, algorithm="maxima")

[Out]

-1/2*((c*arctan(c*x) + 1/x)*c + arctan(c*x)/x^2)*b*d - 1/2*(g*(log(g*x^2 + f)/f - log(x^2)/f) + log(g*x^2 + f)
/x^2)*a*e + 1/2*(2*c*g*x^2*arctan(g*x/sqrt(f*g)) + (4*c^2*g*x^2*integrate(1/2*x*arctan(c*x)/(g*x^2 + f), x) +
4*g*x^2*integrate(1/2*arctan(c*x)/(g*x^3 + f*x), x) - (c*x + (c^2*x^2 + 1)*arctan(c*x))*log(g*x^2 + f))*sqrt(f
*g))*b*e/(sqrt(f*g)*x^2) - 1/2*a*d/x^2

Giac [F(-1)]

Timed out. \[ \int \frac {(a+b \arctan (c x)) \left (d+e \log \left (f+g x^2\right )\right )}{x^3} \, dx=\text {Timed out} \]

[In]

integrate((a+b*arctan(c*x))*(d+e*log(g*x^2+f))/x^3,x, algorithm="giac")

[Out]

Timed out

Mupad [F(-1)]

Timed out. \[ \int \frac {(a+b \arctan (c x)) \left (d+e \log \left (f+g x^2\right )\right )}{x^3} \, dx=\int \frac {\left (a+b\,\mathrm {atan}\left (c\,x\right )\right )\,\left (d+e\,\ln \left (g\,x^2+f\right )\right )}{x^3} \,d x \]

[In]

int(((a + b*atan(c*x))*(d + e*log(f + g*x^2)))/x^3,x)

[Out]

int(((a + b*atan(c*x))*(d + e*log(f + g*x^2)))/x^3, x)